package com.iplant.ams.service.po.ams.asset;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.po.ams.fxt.AMSFrockTool;
import com.iplant.ams.service.po.ams.fxt.AMSMeasureTool;
import com.iplant.ams.service.po.dms.DMSDeviceModel;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.io.Serializable;

@DBBasePO(TableName = "ams_asset_standard_model", CheckName = {"Code", "Name,AssetModel,ClassificationID"},
        Schemas = DBSchemas.AMS, CodeAuto = true, CodePrefix = "ZCXH-")
public class AMSAssetStandardModel extends BasePO implements Serializable {
    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 资产分类ID
     */
    @DBCondition
    @DBField(CheckValue = true)
    public int ClassificationID = 0;

    @DBJoin(name = "Name", tableName = "ams_asset_classification", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "ClassificationID")
    public String ClassificationName = "";

    @DBJoin(name = "Code", tableName = "ams_asset_classification", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "ClassificationID")
    public String ClassificationCode = "";

    @DBCondition
    @DBJoin(name = "TypeEnum", tableName = "ams_asset_classification", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "ClassificationID")
    public int TypeEnum = 0;

    /**
     * 规格型号
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String AssetModel = "";

    /**
     * 计量单位
     */
    @DBField
    public int AssetUnitID = 0;
    @DBJoin(name = "Name", tableName = "mss_unit", tableAsName = "unit1", Schemas = DBSchemas.Basic,
            MainTableField = "AssetUnitID")
    public String AssetUnitName = "";
    @DBJoin(name = "Code", tableName = "mss_unit", tableAsName = "unit1", Schemas = DBSchemas.Basic,
            MainTableField = "AssetUnitID")
    public String AssetUnitCode = "";

    /**
     * 图片
     */
    @DBField
    public String AssetImage = "";

    public void SetModel(DMSDeviceModel wDMSDeviceModel){
        Name=wDMSDeviceModel.Name;
        Code=wDMSDeviceModel.Code;
        AssetModel=wDMSDeviceModel.AssetModel;
        Active=wDMSDeviceModel.Active;
    }

    public void SetModel(AMSFrockTool wAMSFrockTool){
        Name=wAMSFrockTool.Name;
        Code=wAMSFrockTool.Code;
        AssetModel=wAMSFrockTool.Specifications;
        Active=wAMSFrockTool.Active;
    }

    public void SetModel(AMSMeasureTool wAMSMeasureTool){
        Name=wAMSMeasureTool.Name;
        Code=wAMSMeasureTool.Code;
        AssetModel=wAMSMeasureTool.Specifications;
        Active=wAMSMeasureTool.Active;
    }


    public AMSAssetStandardModel(DMSDeviceModel wDMSDeviceModel,AMSAssetClassification wAssetClassification){
        super();
        ID=wDMSDeviceModel.StandardModelID;
        Name=wDMSDeviceModel.Name;
        Code=wDMSDeviceModel.Code;
        AssetModel=wDMSDeviceModel.AssetModel;
        Active=wDMSDeviceModel.Active;
        ClassificationID=wAssetClassification.ID;
        ClassificationName=wAssetClassification.Name;
        ClassificationCode=wAssetClassification.Code;
        TypeEnum=wAssetClassification.TypeEnum;
    }

    public AMSAssetStandardModel(AMSFrockTool wAMSFrockTool, AMSAssetClassification wAssetClassification){
        super();
        ID=wAMSFrockTool.StandardModelID;
        Name=wAMSFrockTool.Name;
        Code=wAMSFrockTool.Code;
        AssetModel=wAMSFrockTool.Specifications;
        Active=wAMSFrockTool.Active;
        ClassificationID=wAssetClassification.ID;
        ClassificationName=wAssetClassification.Name;
        ClassificationCode=wAssetClassification.Code;
        TypeEnum=wAssetClassification.TypeEnum;
    }

    public AMSAssetStandardModel(AMSMeasureTool wAMSMeasureTool, AMSAssetClassification wAssetClassification){
        super();
        ID=wAMSMeasureTool.StandardModelID;
        Name=wAMSMeasureTool.Name;
        Code=wAMSMeasureTool.Code;
        AssetModel=wAMSMeasureTool.Specifications;
        Active=wAMSMeasureTool.Active;
        ClassificationID=wAssetClassification.ID;
        ClassificationName=wAssetClassification.Name;
        ClassificationCode=wAssetClassification.Code;
        TypeEnum=wAssetClassification.TypeEnum;
    }



    public AMSAssetStandardModel() {
        super();
    }

    @JsonProperty("ClassificationID")
    public int getClassificationID() {
        return ClassificationID;
    }

    public void setClassificationID(int classificationID) {
        ClassificationID = classificationID;
    }

    @JsonProperty("ClassificationName")
    public String getClassificationName() {
        return ClassificationName;
    }

    public void setClassificationName(String classificationName) {
        ClassificationName = classificationName;
    }

    @JsonProperty("ClassificationCode")
    public String getClassificationCode() {
        return ClassificationCode;
    }

    public void setClassificationCode(String classificationCode) {
        ClassificationCode = classificationCode;
    }

    @JsonProperty("AssetModel")
    public String getAssetModel() {
        return AssetModel;
    }

    public void setAssetModel(String assetModel) {
        AssetModel = assetModel;
    }

    @JsonProperty("AssetImage")
    public String getAssetImage() {
        return AssetImage;
    }

    public void setAssetImage(String assetImage) {
        AssetImage = assetImage;
    }

    @JsonProperty("TypeEnum")
    public int getTypeEnum() {
        return TypeEnum;
    }

    public void setTypeEnum(int typeEnum) {
        TypeEnum = typeEnum;
    }

    @JsonProperty("AssetUnitID")
    public int getAssetUnitID() {
        return AssetUnitID;
    }

    public void setAssetUnitID(int assetUnitID) {
        AssetUnitID = assetUnitID;
    }

    @JsonProperty("AssetUnitName")
    public String getAssetUnitName() {
        return AssetUnitName;
    }

    public void setAssetUnitName(String assetUnitName) {
        AssetUnitName = assetUnitName;
    }

    @JsonProperty("AssetUnitCode")
    public String getAssetUnitCode() {
        return AssetUnitCode;
    }

    public void setAssetUnitCode(String assetUnitCode) {
        AssetUnitCode = assetUnitCode;
    }


}
